﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace SuperListEx
{
    public static class TableExtensions
    {
        #region extensions
        /// <summary>
        /// Prints the items currently selected in the table
        /// </summary>
        /// <param name="control"></param>
        public static void PrintSelectedItems(this ListControl control, Image header)
        {
            PrintTable pt = new PrintTable(control);
            pt.ToPrint = control.GetSelectedItemList<object>();
            pt.HeaderImage = header;
            pt.Print();
        }

        /// <summary>
        /// Prints the items currently selected in the table
        /// </summary>
        /// <param name="control"></param>
        public static void PrintAllItems(this ListControl control, Image header)
        {
            PrintTable pt = new PrintTable(control);
            pt.ToPrint = control.GetItemList<object>();            
            pt.HeaderImage = header;
            pt.Print();
        }

        /// <summary>
        /// Prints the items currently selected in the table
        /// </summary>
        /// <param name="control"></param>
        public static void PrintPreviewSelectedItems(this ListControl control, Image header)
        {
            PrintTable pt = new PrintTable(control);
            pt.ToPrint = control.GetSelectedItemList<object>();
            pt.HeaderImage = header;
            pt.PrintPreview();
        }

        /// <summary>
        /// Prints the items currently selected in the table
        /// </summary>
        /// <param name="control"></param>
        public static void PrintPreviewAllItems(this ListControl control, Image header)
        {
            PrintTable pt = new PrintTable(control);
            pt.ToPrint = control.GetItemList<object>(); 
            pt.HeaderImage = header;
            pt.PrintPreview();
        }
        #endregion
    }
}
